package org.come.Jpanel;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.ImageObserver;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Map;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.come.Frame.MsgJframe;
import org.come.bean.ConfigureBean;
import org.come.bean.Skill;
import org.come.entity.Goodstable;
import org.come.entity.RoleSummoning;
import org.come.model.Configure;
import org.come.mouslisten.GoodsMouslisten;
import org.come.mouslisten.PetAddPointMouslisten;
import org.come.mouslisten.PetEquipMouslisten;
import org.come.summonequip.JframeSummonEquipMain;
import org.come.summonequip.JpanelSummonEquipMain;
import org.come.until.CutButtonImage;
import org.come.until.FormsManagement;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.SendRoleAndRolesummingUntil;
import org.come.until.UserMessUntil;
import org.come.until.Util;

import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.PetEquipmentBtn;
import com.tool.btn.goodbtn;
import com.tool.image.ImageMixDeal;
import com.tool.pet.PetProperty;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;



public class PetEquipmentJpanel extends JPanel {
    public static int starRating;//召唤兽升星
    public JLabel[] GoodsListLabel = new JLabel[24]; // 用来存放24个物品表格
    // 放置6个背包切换按钮
    private goodbtn[] btnrights;
    private GoodsMouslisten[] goodsMouslistens = new GoodsMouslisten[24];// 用来存放24个物品的格子监听

    private JLabel[] labpetequ = new JLabel[4]; // 放置召唤兽的装备
    /**
     * 召唤兽装备技能槽
     */
    private JLabel equipSkillLab;
    /**
     * 1洗练按钮forgeBtn<br>
     */
    private PetEquipmentBtn forgeBtn;
    /**
     * 召唤兽装备技能信息
     */
    private String equipSkillMessage;

    public PetEquipmentJpanel() {
        if ("水墨UI".equals(MyIsif.getStyle())) {
            this.setPreferredSize(new Dimension(368, 506));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 67);
            offBtn.setBounds(368 - 40, 5, 25, 25);
            this.add(offBtn);

            // 放置召唤兽的装备
            for (int i = 0; i < 4; i++) {
                labpetequ[i] = new JLabel() {
                    @Override
                    protected void paintComponent(Graphics g) {
                        // TODO Auto-generated method stub
                        if (getIcon() != null) {
                            g.setColor(UIUtils.COLOR_Pack);
                            g.fillRect(0, 0, 39, 39);
                        }
                        super.paintComponent(g);
                    }

                };
                PetEquipMouslisten equipMouslisten = new PetEquipMouslisten(this, i);
                labpetequ[i].addMouseListener(equipMouslisten);
                if (i == 3) {
                    labpetequ[i].setBounds(275, 173, 39, 39);
                } else {
                    labpetequ[i].setBounds(41, 56 + i * 49, 39, 39);
                }
                this.add(labpetequ[i]);
            }
            // 存放物品的表格1~24
            for (int i = 0; i < 24; i++) {
                int row = i % 6;
                int col = i / 6;
                GoodsListLabel[i] = new JLabel();
                GoodsListLabel[i].setBounds(26 + row * 51, 268 + col * 51, 49, 49);
                goodsMouslistens[i] = new GoodsMouslisten(i);
                GoodsListLabel[i].addMouseListener(goodsMouslistens[i]);
                this.add(GoodsListLabel[i]);
            }
            // 背包四个页数的按钮
            btnrights = new goodbtn[6];
            for (int i = 0; i < btnrights.length; i++) {
                btnrights[i] = new goodbtn("skin/8100226/newbutton/C0" + (i + 1)+".png", 0, this, i);
//                btnrights[i] = new goodbtn("skin/8100226/button/" + (41 + i) + ".png", 0, this, i);
                btnrights[i].setBounds(332, 265 + i * 35, 35, 31);
                this.add(btnrights[i]);
            }
            getEquipSkillLab();
            getForgeBtn();
        } else {
            this.setPreferredSize(new Dimension(360, 510));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/hongmu/2/8_jpg.button.btn_close.jpg", 1, 67);
            offBtn.setBounds(334, 0, 23, 23);
            this.add(offBtn);

            // 放置召唤兽的装备
            for (int i = 0; i < 4; i++) {
                labpetequ[i] = new JLabel() {
                    @Override
                    protected void paintComponent(Graphics g) {
                        // TODO Auto-generated method stub
                        if (getIcon() != null) {
                            g.setColor(UIUtils.Color_BACK);
                            g.fillRect(0, 0, 39, 39);
                        }
                        super.paintComponent(g);
                    }

                };
                PetEquipMouslisten equipMouslisten = new PetEquipMouslisten(this, i);
                labpetequ[i].addMouseListener(equipMouslisten);
                if (i == 3) {
                    labpetequ[i].setBounds(275, 173, 39, 39);
                } else {
                    labpetequ[i].setBounds(42, 75 + i * 49, 39, 39);
                }
                this.add(labpetequ[i]);
            }
            // 存放物品的表格1~24
            for (int i = 0; i < 24; i++) {
                int row = i % 6;
                int col = i / 6;
                GoodsListLabel[i] = new JLabel();
                GoodsListLabel[i].setBounds(26 + row * 51, 268 + col * 51, 49, 49);
                goodsMouslistens[i] = new GoodsMouslisten(i);
                GoodsListLabel[i].addMouseListener(goodsMouslistens[i]);
                this.add(GoodsListLabel[i]);
            }
            // 背包六个页数的按钮
            btnrights = new goodbtn[6];
            for (int i = 0; i < btnrights.length; i++) {
                btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);
                if (i == 1) {
                    this.btnrights[i].setBounds(79, 472, 50, 26);//包裹2
                } else if (i == 2) {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹3
                    this.btnrights[i].setBounds(130, 472, 50, 26);
                } else if (i == 3) {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹4
                    this.btnrights[i].setBounds(182, 472, 50, 26);
                } else if (i == 4) {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹5
                    this.btnrights[i].setBounds(183 + 50, 472, 50, 26);
                } else if (i == 5) {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹6
                    this.btnrights[i].setBounds(234 + 50, 472, 50, 26);
                } else {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹1
                    this.btnrights[i].setBounds(27, 472, 50, 26);
                }
                this.add(this.btnrights[i]);
            }

            getEquipSkillLab();
            getForgeBtn();
        }
    }

    /**
     * 重置可用按钮类型
     */
    public void btntype(int path) {
        for (int i = 0; i < path; i++) {
            btnrights[i].btntypechange(2);
        }
    }

    PetEquipMouslisten equipMouslisten2;

    /**
     * 初始化召唤兽装备
     */
    public void showPet(RoleSummoning pet) {
        for (int i = 0; i < labpetequ.length; i++) {
            labpetequ[i].setIcon(null);
        }
        String stype = pet.getStye();
        if (stype == null || stype.length() <= 1) {
            return;
        }
        String[] v = stype.split("\\|");
        for (int i = 1; i < v.length; i++) {
            String[] vs = v[i].split("-");
            if (vs.length >= 2) {
                Goodstable goodstable = GoodsListFromServerUntil.fushis.get(new BigDecimal(vs[1]));
                if (goodstable != null) {
                    ImageIcon icon = GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 49, 49);
                    labpetequ[Integer.parseInt(vs[0])].setIcon(icon);
                    equipMouslisten2 = new PetEquipMouslisten(null, i, goodstable);
                    labpetequ[Integer.parseInt(vs[0])].addMouseListener(equipMouslisten2);
                }
            }
        }
        trueSkillIdView(v);
        equipSkillMessage = trueSkillId(v);
    }

    /**
     * 判断三个召唤兽装备觉醒技是否一致(返回三个觉醒技的平均值)
     */
    public String trueSkillId(String[] v) {
        StringBuffer skillMessage = null;
        ArrayList<Goodstable> summonEquips = JframeSummonEquipMain.getJframeSummonEquipMain()
                .getJpanelSummonEquipMain().getSummonEquips(v);
        if (summonEquips.size() < 3) {
        } else {// 有三个装备时
            String[] skillIds = new String[3];
            for (int j = 0; j < summonEquips.size(); j++) {
                String[] values = summonEquips.get(j).getValue().split("\\|");
                // 取出觉醒技
                String valuesMessage = JframeSummonEquipMain.getJframeSummonEquipMain().getJpanelSummonEquipMain()
                        .getValuesMessage(values, "觉醒技");
                if (valuesMessage != null) {// 存在召唤兽装备技能
                    // 取出召唤兽装备技能Id
                    skillIds[j] = valuesMessage;
                } else {
                    break;
                }
                if (j == 2) {
                    String[] skillOne = skillIds[0].split("&");
                    String[] skillTwo = skillIds[1].split("&");
                    String[] skillThree = skillIds[2].split("&");
                    if (skillOne[1].equals(skillTwo[1]) && skillOne[1].equals(skillThree[1])) {// 三个装备的觉醒技一致
                        skillMessage = new StringBuffer();
                        BigDecimal quality = averageMath(skillOne[2], skillTwo[2], skillThree[2]);
                        BigDecimal exp = averageMath(skillOne[3], skillTwo[3], skillThree[3]);
                        skillMessage.append(skillOne[1]);
                        skillMessage.append("&");
                        skillMessage.append(quality);
                        skillMessage.append("&");
                        skillMessage.append(exp.intValue());
                    }
                }
            }
        }
        return skillMessage == null ? null : skillMessage.toString();
    }

    /**
     * 判断三个召唤兽装备觉醒技是否一致(刷新页面)
     */
    public void trueSkillIdView(String[] v) {
        ArrayList<Goodstable> summonEquips = JframeSummonEquipMain.getJframeSummonEquipMain()
                .getJpanelSummonEquipMain().getSummonEquips(v);
        if ("水墨UI".equals(MyIsif.getStyle())) {
            if (summonEquips.size() < 3) {
                equipSkillLab.setIcon(CutButtonImage.getImage("inkImg/old/lingbao/msg/圆封.png", 28, 28));
            } else {// 有三个装备时
                String[] skillIds = new String[3];
                for (int j = 0; j < summonEquips.size(); j++) {
                    String[] values = summonEquips.get(j).getValue().split("\\|");
                    // 取出觉醒技
                    String valuesMessage = JframeSummonEquipMain.getJframeSummonEquipMain().getJpanelSummonEquipMain()
                            .getValuesMessage(values, "觉醒技");
                    if (valuesMessage != null) {// 存在召唤兽装备技能
                        // 取出召唤兽装备技能Id
                        skillIds[j] = valuesMessage.split("&")[1];
                    } else {
                        break;
                    }
                    if (j == 2) {
                        if (skillIds[0].equals(skillIds[1]) && skillIds[0].equals(skillIds[2])) {// 三个装备的觉醒技一致
                            equipSkillLab.setIcon(CutButtonImage.getImage("inkImg/old/skill/jx.png", -1, -1));
                        } else {
                            equipSkillLab.setIcon(CutButtonImage.getImage("inkImg/old/lingbao/msg/圆封.png", -1, -1));
                        }
                    }
                }
            }
        } else {
            if (summonEquips.size() < 3) {
                equipSkillLab.setIcon(CutButtonImage.getImage("inkImg/old/lingbao/msg/圆封.png", 28, 28));
            } else {// 有三个装备时
                String[] skillIds = new String[3];
                for (int j = 0; j < summonEquips.size(); j++) {
                    String[] values = summonEquips.get(j).getValue().split("\\|");
                    // 取出觉醒技
                    String valuesMessage = JframeSummonEquipMain.getJframeSummonEquipMain().getJpanelSummonEquipMain()
                            .getValuesMessage(values, "觉醒技");
                    if (valuesMessage != null) {// 存在召唤兽装备技能
                        // 取出召唤兽装备技能Id
                        skillIds[j] = valuesMessage.split("&")[1];
                    } else {
                        break;
                    }
                    if (j == 2) {
                        if (skillIds[0].equals(skillIds[1]) && skillIds[0].equals(skillIds[2])) {// 三个装备的觉醒技一致
                            equipSkillLab.setIcon(CutButtonImage.getImage("inkImg/old/skill/jx.png", -1, -1));
                        } else {
                            equipSkillLab.setIcon(CutButtonImage.getImage("inkImg/old/lingbao/msg/圆封.png", -1, -1));
                        }
                    }
                }
            }
        }

        JpanelSummonEquipMain jpanelSummonEquipMain = JframeSummonEquipMain.getJframeSummonEquipMain()
                .getJpanelSummonEquipMain();
        if (jpanelSummonEquipMain.getJpanelNowEquip().isVisible()) {
            jpanelSummonEquipMain.getpaneMessage();
        }
    }

    /**
     * 三个参数求平均
     */
    public static BigDecimal averageMath(String one, String two, String three) {
        return (new BigDecimal(one).add(new BigDecimal(two)).add(new BigDecimal(three))).divide(new BigDecimal(3), 2,
                BigDecimal.ROUND_HALF_UP);
    }

    /**
     * 穿脱装备 0-3脱指定位置装备 -1是穿装备 good不为空
     */
    public void Equip(RoleSummoning pet, Goodstable good, int type) {
        String yb = pet.getStye();
        BigDecimal id = null;
        if (type != -1) {
            id = pet.ChangePart(null, type);
            labpetequ[type].setIcon(null);
            for (MouseListener mouseListener : labpetequ[type].getMouseListeners()) {
                labpetequ[type].removeMouseListener(mouseListener);
            }
        } else {
            type = getPetGoodType(good.getType());
            PetEquipMouslisten equipMouslisten = new PetEquipMouslisten(this, type);
            labpetequ[type].addMouseListener(equipMouslisten);

            equipMouslisten2 = new PetEquipMouslisten(null, type, good);
            labpetequ[type].addMouseListener(equipMouslisten2);

            labpetequ[type].setIcon(GoodsListFromServerUntil.imgpathAdaptive(good.getSkin(), 49, 49));
            good.setStatus(1);
            GoodsMouslisten.gooduse(good, 0);
            GoodsListFromServerUntil.Deletebiaoid(good.getRgid());
            id = pet.ChangePart(good, type);
            GoodsListFromServerUntil.fushis.put(good.getRgid(), good);
        }
        Goodstable goodstable = GoodsListFromServerUntil.fushis.remove(id);
        if (goodstable != null) {
            goodstable.setStatus(0);
            GoodsMouslisten.gooduse(goodstable, 0);
            GoodsListFromServerUntil.addGood(goodstable);
        }
        int[] pets = PetProperty.getPetHMASp(pet);
        pet.setBasishp(pets[0]);
        pet.setBasismp(pets[1]);
        PetAddPointMouslisten.showPetValue();
        TestPetJpanel.part = null;
        if (!yb.equals(pet.getStye())) {
            SendRoleAndRolesummingUntil.sendRoleSumming(pet);
        }
        trueSkillIdView(pet.getStye().split("\\|"));
    }

    /**
     * 获取装备的类型
     */
    // 0兽环 1兽铃 2兽甲 3彩晶石
    public static int getPetGoodType(Long type) {
        if (type == 510) {
            return 0;
        } else if (type == 511) {
            return 1;
        } else if (type == 512) {
            return 2;
        } else if (type == 729) {
            return 3;
        }
        return 4;
    }

    private ImageIcon icon_sm = new ImageIcon( "inkImg/newbackground/B255.png");

    private ImageIcon icon_sm1 = new ImageIcon("inkImg/old/background/S64.png");

    private ImageIcon icon_hm = new ImageIcon("inkImg/hongmu/2/petequipment.png");
    public final ImageIcon mxx  = new ImageIcon("img/xy2uiimg/经验_星_满_w15,h16.png");//召唤兽升星
    public final ImageIcon kxx  = new ImageIcon("img/xy2uiimg/经验_星_无_w15,h16.png");
    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        super.paintComponent(g);
        if ("水墨UI".equals(MyIsif.getStyle())) {
            if (Util.zzs == 8) {//召唤兽装备

                g.drawImage(icon_sm.getImage(), 0, 0, 356, 506, this);
                if (TestPetJpanel.part != null) {
                    TestPetJpanel.part.draw(g, 185, 185, 0, ImageMixDeal.userimg.getTime());
                }
                // 画物品的图片和数量
                GoodsListFromServerUntil.draw(g, 26, 268);
            } else {
                g.drawImage(icon_sm.getImage(), 0, 0, 356, 506, this);
                if (TestPetJpanel.part != null) {
                    TestPetJpanel.part.draw(g, 185, 185, 0, ImageMixDeal.userimg.getTime());
                }
                // 画物品的图片和数量
                GoodsListFromServerUntil.draw(g, 26, 268);
            }
        } else {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                g.drawImage(icon_sm1.getImage(), 0, 0, 360, 499, this);
                if (TestPetJpanel.part != null) {
                    TestPetJpanel.part.draw(g, 185, 185, 0, ImageMixDeal.userimg.getTime());
                }
                // 画物品的图片和数量
                GoodsListFromServerUntil.draw(g, 26, 268);
            } else {
                g.drawImage(icon_hm.getImage(), 0, 0, 360, 510, this);
                if (TestPetJpanel.part != null) {
                    TestPetJpanel.part.draw(g, 185, 185, 0, ImageMixDeal.userimg.getTime());
                }
                // 画物品的图片和数量
                GoodsListFromServerUntil.draw(g, 26, 268);
            }
        }
        int ys = 60;//召唤兽升星
        int xs = 5;
        int petindex = starRating;
        if(petindex == 0) {
            g.drawImage(kxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 30) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 90) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 180) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 300) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 450) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 600) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 750) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 900) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 1050) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(kxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
        }else if(petindex == 1200) {
            g.drawImage(mxx.getImage(), xs+100, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);
            g.drawImage(mxx.getImage(), xs+100+17+17+17+17+17+17+17+17+17, ys, kxx.getIconWidth(), kxx.getIconHeight(), (ImageObserver)this);

        }
    }

    public JLabel[] getGoodsListLabel() {
        return GoodsListLabel;
    }

    public void setGoodsListLabel(JLabel[] goodsListLabel) {
        GoodsListLabel = goodsListLabel;
    }

    public goodbtn[] getBtnrights() {
        return btnrights;
    }

    public void setBtnrights(goodbtn[] btnrights) {
        this.btnrights = btnrights;
    }

    public GoodsMouslisten[] getGoodsMouslistens() {
        return goodsMouslistens;
    }

    public void setGoodsMouslistens(GoodsMouslisten[] goodsMouslistens) {
        this.goodsMouslistens = goodsMouslistens;
    }

    public JLabel[] getLabpetequ() {
        return labpetequ;
    }

    public void setLabpetequ(JLabel[] labpetequ) {
        this.labpetequ = labpetequ;
    }

    public JLabel getEquipSkillLab() {
        if (equipSkillLab == null) {
            equipSkillLab = new JLabel();
            equipSkillLab.setIcon(CutButtonImage.getImage("inkImg/old/lingbao/msg/圆封.png", -1, -1));
            equipSkillLab.setBounds(165, 199, 28, 28);
            equipSkillLab.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseEntered(MouseEvent e) {
                    if (equipSkillMessage != null) {
                        String[] split = equipSkillMessage.split("&");
                        Skill skill = UserMessUntil.getSkillId(split[0]);
                        MsgJframe
                                .getJframe()
                                .getJapnel()
                                .TYC(skill != null ? skill.getSkillname() : "",
                                        " #cFFFF00【技能等级】 "
                                                + JpanelSummonEquipMain.expChangeLevel(Long.parseLong(split[2]))
                                                + "#r 【类型】 通用#r#G"
                                                + GoodsMsgJpanel.SummonSkillRemark(skill.getRemark(), skill, split[1],
                                                JpanelSummonEquipMain.expChangeLevel(Long.parseLong(split[2]))
                                                        + ""));
                    }
                }

                @Override
                public void mouseExited(MouseEvent e) {
                    FormsManagement.HideForm(46);// 隐藏窗体
                }
            });
            this.add(equipSkillLab);
        }
        return equipSkillLab;
    }

    public void setEquipSkillLab(JLabel equipSkillLab) {
        this.equipSkillLab = equipSkillLab;
    }


    public PetEquipmentBtn getForgeBtn() {
        ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
        Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
        Configure configure = item.get(new BigDecimal(1));

        if (forgeBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                forgeBtn = new PetEquipmentBtn("skin/8100226/newbutton/B20.png", 1, "洗练", 1);
                forgeBtn.setColors(UIUtils.COLOR_WHITE2);
                forgeBtn.setBounds(150, 230, 59, 24);
            } else {
                forgeBtn = new PetEquipmentBtn("inkImg/hongmu/1/1_png.button.btn_xy.png", 1, "洗 练", 1);
                forgeBtn.setBounds(140, 230, 80, 26);
            }
            if (!"3".equals(configure.getLzjskg())) {
                this.add(forgeBtn);
            }
        }
        return forgeBtn;
    }

    public void setForgeBtn(PetEquipmentBtn forgeBtn) {
        this.forgeBtn = forgeBtn;
    }

    public String getEquipSkillMessage() {
        return equipSkillMessage;
    }

    public void setEquipSkillMessage(String equipSkillMessage) {
        this.equipSkillMessage = equipSkillMessage;
    }

}
